package com.hxzy.rabbitmqpublisher.controller;

import com.hxzy.common.QueueConst;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author wy
 * @Description TODO
 * @Date 2024/2/21 14:48
 * @Version 1.0
 */
@RestController
public class Demo01Controller {

    @Autowired
    private RabbitTemplate  rabbitTemplate;

    @GetMapping(value = "/demo01/send01")
    public String sendMessage(String msg){

        this.rabbitTemplate.convertAndSend(QueueConst.QUEUE01,msg);

        return "消息发送成功";
    }
}
